#include "agenda.h"

agenda::agenda()
{

}

//日程构造函数
agenda::agenda(int id, string s_date, string s_time, string e_date, string e_time, string detail)
{
	this->id = id;
	this->s_date = s_date;
	this->s_time = s_time;
	this->e_date = e_date;
	this->e_time = e_time;
	this->detail = detail;
}

//重载小于运算符用于开始时间比较
bool agenda::operator<(agenda &right)
{
	if(this->s_date < right.s_date)
		return true;
	else if(this->s_date > right.s_date)
		return false;
	else
	{
		if(this->s_time < right.s_time)
			return true;
		else if(this->s_time > right.s_time)
			return false;
		else return false;
	}
}

//重载大于运算符用于开始时间比较
bool agenda::operator>(agenda &right)
{
	if(this->s_date > right.s_date)
		return true;
	else if(this->s_date < right.s_date)
		return false;
	else
	{
		if(this->s_time > right.s_time)
			return true;
		else if(this->s_time < right.s_time)
			return false;
		else return false;
	}
}

//重载输出流操作符
ostream &operator<<(ostream &os, agenda &obj)
{
	os << obj.id << "  ";
	os << obj.s_date << "  ";
	os << obj.s_time << "  ";
	os << obj.e_date << "  ";
	os << obj.e_time << "  ";
	os << obj.detail << "\n";
	return os;
}

//重载输入流操作符
istream &operator>>(istream &is, agenda &obj)
{
	is >> obj.id;
	is >> obj.s_date;
	is >> obj.s_time;
	is >> obj.e_date;
	is >> obj.e_time;
	is >> obj.detail;
	return is;
}